package day04;

import java.util.Scanner;

public class CommandBySwitch1 {
    public static void main(String[] args) {
        double balance =0;
        double draw = 0;
        System.out.println("请输入您的选项：1.存款 2.取款 3.查询余额 4.退卡");
        Scanner sc = new Scanner(System.in);

        while (true){
            int switch1 = sc.nextInt();
            if (switch1>4||switch1<1){
                System.out.println("您的输入有误");
                System.out.println("请输入您的选项：1.存款 2.取款 3.查询余额 4.退卡");
            }else{
                switch (switch1){
                    case 1:
                        System.out.println("----------输入您的存款金额------------");
                        balance +=sc.nextDouble();
                        System.out.println("-----------您的余额为："+balance+"----------");
                        break;
                    case 2:
                        System.out.println("------------输入您的取款金额-----------");
                        draw = sc.nextDouble();
                        if (balance>draw){
                        balance -=draw;

                        }
                        break;
                    case 3:
                        System.out.println("------------您的余额为："+balance+"-------------");
                        break;
                    case 4:
                        System.out.println("------------退卡成功-------------");
                        break;

                }
            }







        }
    }
}
